package com.ldx.java_chatroom.controller;

import com.ldx.java_chatroom.model.User;
import com.ldx.java_chatroom.service.MessageSessionService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.SessionAttribute;

@RestController
public class MessageSessionController {
    @Resource
    private MessageSessionService messageSessionService;
    @RequestMapping("/getSessionList")
    public Object getSessionList(HttpSession session){
        return messageSessionService.getSessionList(session);
    }
    @RequestMapping("/session")
    public Object addMessageSession(int toUserId, @SessionAttribute("User")User user){
        return messageSessionService.addMessageSession(toUserId,user);
    }
}
